using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using EntLibEC.Info.Online;

namespace EntLibEC.Dac.Online
{
    public class FriendLinkDac
    {
        public void Add(FriendLinkInfo friendLinkInfo)
        {
            string strInsert = @"Insert Into Ent_FriendLink (WebSiteName, WebSiteUrl, WebSiteLogo,Email, LinkType, Status, Note) 
                values (@WebSiteName, @WebSiteUrl, @WebSiteLogo,@Email, @LinkType, @Status, @Note)";
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strInsert);

            db.AddInParameter(dbCommand, "WebSiteName", DbType.String, friendLinkInfo.WebSiteName);
            db.AddInParameter(dbCommand, "WebSiteUrl", DbType.String, friendLinkInfo.WebSiteUrl);
            db.AddInParameter(dbCommand, "WebSiteLogo", DbType.String, friendLinkInfo.WebSiteLogo);
            db.AddInParameter(dbCommand, "Email", DbType.String, friendLinkInfo.Email);
            db.AddInParameter(dbCommand, "LinkType", DbType.Int32, friendLinkInfo.LinkType);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, friendLinkInfo.Status);
            db.AddInParameter(dbCommand, "Note", DbType.String, friendLinkInfo.Note);

            db.ExecuteNonQuery(dbCommand);
        }
    }
}
